home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / lib / posix / pathconf.c < prev    next >
C/C++ Source or Header  |  1990-07-19  |  679b  |  27 lines

  1. /* POSIX pathconf (Sec. 5.7.1)         Author: Andy Tanenbaum */
  2.  
  3. #include <lib.h>
  4. #include <sys/types.h>
  5. #include <fcntl.h>
  6. #include <errno.h>
  7. #include <unistd.h>
  8.  
  9. long pathconf(path, name)
  10. char *path;            /* name of file being interrogated */
  11. int name;            /* property being inspected */
  12. {
  13. /* POSIX allows some of the values in <limits.h> to be increased at
  14.  * run time.  The pathconf and fpathconf functions allow these values
  15.  * to be checked at run time.  MINIX does not use this facility.
  16.  * The run-time limits are those given in <limits.h>.
  17.  */
  18.  
  19.   int fd;
  20.   long val;
  21.  
  22.   if ( (fd = open(path, O_RDONLY)) < 0) return(-1L);
  23.   val = fpathconf(fd, name);
  24.   close(fd);
  25.   return(val);
  26. }
  27.